<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>推流</title>
    <script src="https://video.sdk.qcloudecdn.com/web/TXLivePusher-2.1.1.min.js" charset="utf-8"></script>
</head>

<body>
    <div id="local_video" style="width:100%;height:500px;display:flex;align-items:center;justify-content:center;"></div>
    <script>
        const livePusher = new TXLivePusher();
        livePusher.setRenderView('local_video');
        livePusher.videoView.muted = true;
        // 设置视频质量
        livePusher.setVideoQuality('720p');
        // 设置音频质量
        livePusher.setAudioQuality('standard');
        // 自定义设置帧率
        livePusher.setProperty('setVideoFPS', 25);

        // 采集完摄像头画面后自动推流
        livePusher.startCamera()
            .then(function () {
                livePusher.startPush('webrtc://5664.liveplay.myqcloud.com/live/5664_harchar1');
            })
            .catch(function (error) {
                console.log('打开摄像头失败: ' + error.toString());
            });
    </script>
</body>

</html>